package io.netty.myExample.zhanglong.p33JavaNio体系;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

public class NioTest2 {
    public static void main(String[] args) throws Exception {
        FileInputStream file = new FileInputStream("D:\\dyt-study\\netty-study\\src\\main\\java\\com\\duyutian\\zhanglong\\p33JavaNio体系\\duyutian.txt");
        FileChannel channel = file.getChannel();
        ByteBuffer allocate = ByteBuffer.allocate(512);
        channel.read(allocate);
        allocate.flip();
        while (allocate.remaining() > 0) {
            byte b = allocate.get();
            System.out.println((char) b);
        }
        file.close();
        System.out.println("---");
        int i = 104;
        System.out.println((char)i);

    }
}
